The background description provided herein is for the purpose of generally presenting the context of the disclosure. Work of the presently named inventor, to the extent it is described in this background section, as well as aspects of the description that may not otherwise qualify as prior art at the time of filing, are neither expressly nor impliedly admitted as prior art against the present disclosure.
Today, many software applications that utilize graphics cards (i.e., hardware dedicated to efficiently rendering images) include graphics programs called “shaders.” Generally speaking, shaders allow developers to directly access a graphics card and utilize its large computational power to achieve visually rich rendering with interactive performance. A typical graphics card includes a graphics processing unit (GPU) designed to efficiently execute parallel processing functions and, more particularly, to efficiently process multiple transformations of geometric shapes and colors. A graphics card also includes a memory that stores data buffers on which the GPU operates.
Many applications that include graphics functionality rely on Open Graphics Library (OpenGL) standard specification, which provides a cross-platform and cross-language development environment, and many shaders are described in a specialized language called OpenGL Shading Language (GLSL). A software library called Web-based Graphics Library (WebGL) allows developers of web pages to write scripts (for example, using JavaScript™) that include GLSL code. More particularly, developers can use GLSL to write code for vertex shaders, fragment shaders, and define variables of various scope (e.g., global variables, variables that define an interface between shaders, etc.). Vertex shaders generally operate on vertices in two- or three-dimensional space, while fragment shaders operate on individual pixels. For example, a vertex shader can specify how vertices of a triangle stored in a buffer should be transformed to render the triangle in a particular way depending on the perspective, rotation, etc. A fragment shader can then generate pixels of appropriate color inside the triangle.
A GLSL shader in general executes much faster than JavaScript, and developers accordingly include a significant amount of program logic in GLSL programs. For example, the direction of the shadow a building casts or the location of an orbiting object can be computed directly in a shader instead of JavaScript code. However, once compiled, a GLSL shader executes directly on a graphics card, and thus the shader is difficult to test. Because the final output of the GLSL shader is color, developers cannot simply add debugging or logging information to a GLSL program via GLSL instructions. Instead, developers often need to render an entire scene and analyze the entire rendered image.